package com.example.desinger.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("students")
public class Students {
    @TableField("class_id")
    private int classId;
    private int id;
    private String account;
    private String nickname;
    private String password;
    private int sex;

    private Students(Builder builder) {
        this.classId = builder.classId;
        this.id = builder.id;
        this.account = builder.account;
        this.nickname = builder.nickname;
        this.password = builder.password;
        this.sex = builder.sex;
    }

    public static class Builder {
        private int classId;
        private int id;
        private String account;
        private String nickname;
        private String password;

        private int sex;

        // Build 模式
        public Builder withClassId(int classId) {
            this.classId = classId;
            return this;
        }

        public Builder withId(int id) {
            this.id = id;
            return this;
        }

        public Builder withAccount(String account) {
            this.account = account;
            return this;
        }

        public Builder withNickname(String nickname) {
            this.nickname = nickname;
            return this;
        }

        public Builder withPassword(String password) {
            this.password = password;
            return this;
        }

        public Builder withSex(int sex) {
            this.sex = sex;
            return this;
        }

        public Students build() {
            return new Students(this);
        }

    }


}
